<template>
    <div class="menu-container">
        <template v-for="item in myRoutes.routes" :key="(item as any).path">
            <template v-if="(item as any).children">
                <template v-for="el in (item as any).children">
                    <el-menu-item :index="(el as any).path" @click="goRoute">
                        <el-icon>
                            <component :is="(el as any).meta.icon"></component>
                        </el-icon>
                        <template #title>
                            <span>{{ (el as any).meta.title }}</span>
                        </template>
                    </el-menu-item>
                </template>
            </template>
        </template>

    </div>
</template>

<script setup lang='ts'>
import { useRouter } from 'vue-router';
let $router = useRouter()
let myRoutes = defineProps({
    routes: Array,
})
const goRoute = (item:any)=>{
    $router.push(item.index)
}

</script>

<style lang="scss" scoped>

</style>